<template>
    <div class="page-wrapper">
        <div class="header">
            <van-search v-model="searchValue" show-action placeholder="请输入搜索关键词">
                <template #action>
                    <div @click="onClickButton">搜索</div>
                </template>
            </van-search>
        </div>
        <div class="chooseDay" @click="show = true">
            <text>2023.19-2023.09.18</text>
            <img src="@/assets/merchant/toNext3.png" alt="" />
        </div>

        <div class="allMoney">
            <div class="left">
                <div class="label">5553424532.00</div>
                <div class="value">总交易金额(元)</div>
            </div>
            <div class="left">
                <div class="label">5553</div>
                <div class="value">总交易笔数</div>
            </div>
        </div>
        <div class="cards">
            <div class="card" v-for="item in 10" :key="item">
                <img src="@/assets/merchant/d.png" alt="" class="left">
                <div class="card-content">
                    <div class="t">
                        <div class="l">贷记卡</div>
                        <div class="r">-990.00</div>
                    </div>
                    <div class="t" style="margin-top: 10px">
                        <div class="c">
                            <text>交易SN：121121717532087</text>
                            <img src="@/assets/merchant/copy.png" alt="">
                        </div>
                    </div>
                    <div class="t" style="margin-top: 5px">
                        <div class="c">
                            <text>交易单号：aksdh8794121513543051d5</text>
                            <img src="@/assets/merchant/copy.png" alt="">
                        </div>
                    </div>
                    <div class="t" style="margin-top: 5px">
                        <div class="c">
                            <text>交易时间：20238.19-2023.09.18</text>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <van-calendar color="#66d6ff" v-model:show="show" type="range" @confirm="onConfirm" />
    </div>
</template>

<script lang="ts" setup>
import { parseTime } from '@/utils/utils'

const searchValue = ref('')
const date = ref('')
const show = ref(false)
const onClickButton = () => {
    console.log(searchValue.value)
}

const onConfirm = values => {
    const [start, end] = values
    show.value = false
    date.value = `${parseTime(start, '{y}.{m}.{d}')} - ${parseTime(end, '{y}.{m}.{d}')}`
    console.log(date.value)
}
</script>

<style scoped lang="scss">
.header {
    position: sticky;
    top: 0;
    background: #ffffff;
}
.chooseDay {
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    font-family: SimHei;
    img {
        height: 10px;
        width: 10px;
        margin-left: 10px;
    }
}
.allMoney {
    display: flex;
    padding: 0 10px;
    justify-content: space-between;
    .left {
        border-radius: 8px;
        background: #66d6ff;
        padding: 10px 16px;
        line-height: 25px;
        width: calc(50% - 5px);
        .label {
            font-size: 16px;
            font-family: DingTalk JinBuTi;
            font-weight: 400;
            color: #ffffff;
        }
        .value {
            font-size: 12px;
            font-family: SimHei;
            font-weight: 400;
            color: #ffffff;
        }
    }
}
.cards{
    padding: 0 10px 10px 10px;
    .card{
        background: #FFFFFF;
        border-radius: 8px;
        padding:10px;
        margin-top: 10px;
        display: flex;
        .left{
            height: 32px;
            width: 32px;
        }
        .card-content{
            flex: 1;
            padding: 0 10px;
            .t{
                display: flex;
                justify-content: space-between;
                .l{
                    font-size: 14px;
                    font-weight: 500;
                    color: #000000;
                    opacity: 1;
                }
                .r{
                    font-size: 14px;
                    font-weight: 500;
                    color: #000000;
                    opacity: 1;
                }
                .c {
                    font-size: 12px;
                    font-weight: 400;
                    color: #9F9F9F;
                    display: flex;
                    align-items: center;
                    opacity: 1;
                    img{
                        width: 13px;
                        margin-left: 5px;
                        height: 13px;
                    }
                }
            }

        }
    }
}
</style>
